// -------------------账户管理-------------------
import fetch from '../config/fetch';
var pageSize = 10;

/**
 * 获取所有支付记录
 */
export const getPayRecord = (pageNumber, id) => fetch({
  url: '/payRecord/v1',
  method: "get",
  data: {pageNumber: pageNumber, orgId: id, pageSize}
});

/**
 * 获取组织账号信息
 */
export const getAccountInfo = () => fetch({
  url: '/organization/v1/account',
  method: "get",
  data: {}
});

/**
 * 获取组织结算记录
 */
export const getSettlementPayRecord = (pageNumber) => fetch({
  url: '/payRecord/v1/settlement',
  method: "get",
  data: {pageNumber: pageNumber, pageSize}
});

//---------------- 提现--------------------
/**
 * 增加一条提现记录
 * params: {
    "amount": 0,
    "outerAccount": "string",
    "outerPayMethod": "TEST",
    "remark": "string",
    "status": "NONE"
  }
 */
export const addRequest = (data) => fetch({
  url: '/cashRequest/v1',
  method: "post",
  data: data
});

/**
 * 获取某种状态的所有提现记录
 * params: {
 * status: 'PENDING' 'REJECTED' 'CONFIRM'
 * }
 */
export const getAllRequest = (status, pageNumber) => fetch({
  url: '/cashRequest/v1',
  method: "get",
  data: { status: status, pageNumber: pageNumber, pageSize }
});

/**
 * 获取自己的提现记录
 * params: {
 * status: 'PENDING' 'REJECTED' 'ACCEPTED'
 * }
 */
export const getOwnerRequest = (status, pageNumber) => fetch({
  url: '/cashRequest/v1/org',
  method: "get",
  data: { status: status, pageNumber: pageNumber, pageSize }
});

/**
 * 同意某一条提现申请
 */
export const confirmOwnerRequest = (id) => fetch({
  url: '/cashRequest/v1/' + id + '/accept',
  method: "put",
  data: {}
});

/**
 * 取消某一条提现
 */
export const cancelOwnerRequest = (id) => fetch({
  url: '/cashRequest/v1/' + id + '/cancel',
  method: "put",
  data: {}
});

/**
 * 设置某一条提现申请已经处理完成
 */
export const doneOwnerRequest = (id) => fetch({
  url: '/cashRequest/v1/' + id + '/done',
  method: "put",
  data: {}
});

/**
 * 设置某一条提现申请为转账中
 */
export const progressOwnerRequest = (id) => fetch({
  url: '/cashRequest/v1/' + id + '/progress',
  method: "put",
  data: {}
});

/**
 * 拒绝某一条提现申请
 * params: {
 * remark: 'String' //拒绝理由
 * }
 */
export const rejectOwnerRequest = (id, data) => fetch({
  url: '/cashRequest/v1/' + id + '/reject',
  method: "put",
  data: JSON.stringify(data)
});

// -------------------账户管理-------------------
